package java5;

import java.io.IOException;
import java.io.PrintStream;
import  static java.lang.System.out;

/**
 * @author lwx
 * @create 2018-06-20 10:59
 */
public class StaticImportTest {

    public static void writeError(PrintStream err, String msg)
            throws IOException {

        // Note that err in the parameter list overshadows the imported err
        err.println(msg);
    }
    public static void main(String[] args) {
        if (args.length < 2) {
            System.err.println( //正常用法
                    "Incorrect usage: java com.oreilly.tiger.ch08 [arg1] [arg2]");
            return;
        }
        out.println("Good morning, " + args[0]);//静态导入
        out.println("Have a " + args[1] + " day!");
        try {
            writeError(System.out, "Error occurred.");
        } catch (IOException e) {
            e.printStackTrace();
        }
    }
}
